#include "DocTemplate.h"


// Defaulte Function : Create & Destory & Operator //

DocTemplate::DocTemplate()
{
	// Tistory RSS 2.0 template ///////////////////////////////////////////////////////////////////////////////
	//								 ROLE          	    START              		    END
	this->tistoryRSS2_0.SetTemplate( "xml_version", 	"<?xml version=\"", 		"\""					 );
	this->tistoryRSS2_0.SetTemplate( "encoding", 		"encoding=\"", 				"\"?>"					 );
	this->tistoryRSS2_0.SetTemplate( "rss_version", 	"<rss version=\"", 			"\">" 					 );
	this->tistoryRSS2_0.SetTemplate( "channel",		    "<channel>", 				"</channel>" 			 );
	this->tistoryRSS2_0.SetTemplate( "chTitle",		    "<title>", 					"</title>" 				 );
	this->tistoryRSS2_0.SetTemplate( "chLink", 			"<link>", 					"</link>"				 );
	this->tistoryRSS2_0.SetTemplate( "chDesc", 			"<description>",			"</description>"  		 );
	this->tistoryRSS2_0.SetTemplate( "language", 		"<language>", 				"</language>" 			 );
	this->tistoryRSS2_0.SetTemplate( "chPubDate", 		"<pubDate>", 				"</pubDate>"			 );
	this->tistoryRSS2_0.SetTemplate( "generator", 		"<generator>",				"</generator>"			 );
	this->tistoryRSS2_0.SetTemplate( "chAuthor", 		"<managingEditor>", 		"</managingEditor>"  	 );
	this->tistoryRSS2_0.SetTemplate( "image", 			"<image>", 					"</image>" 				 );
	this->tistoryRSS2_0.SetTemplate( "imgTitle", 		"<title>", 					"</title>" 				 );
	this->tistoryRSS2_0.SetTemplate( "imgUrl", 			"<url><![CDATA[",		    "]]></url>" 			 );
	this->tistoryRSS2_0.SetTemplate( "imgWidth", 		"<width>", 					"</width>" 				 );
	this->tistoryRSS2_0.SetTemplate( "imgHeight", 		"<height>",	 				"</height>" 			 );
	this->tistoryRSS2_0.SetTemplate( "imgDesc", 		"<description>", 			"</description>" 		 );
	this->tistoryRSS2_0.SetTemplate( "item", 			"<item>", 					"</item>" 				 );
	this->tistoryRSS2_0.SetTemplate( "itemTitle", 		"<title>", 					"</title>" 				 );
	this->tistoryRSS2_0.SetTemplate( "itemLink", 		"<link>", 					"</link>" 				 );
	this->tistoryRSS2_0.SetTemplate( "itemDesc", 		"<description>", 			"</description>" 		 );
	this->tistoryRSS2_0.SetTemplate( "itemAuthor", 		"<author>", 				"</author>" 			 );
	this->tistoryRSS2_0.SetTemplate( "tag", 			"<category>", 				"</category>"			 );
	this->tistoryRSS2_0.SetTemplate( "itemPubDate", 	"<pubDate>", 				"</pubDate>"			 );
	this->tistoryRSS2_0.SetTemplate( "comments", 		"<comments>", 				"</comments>"			 );

	// Naver RSS 2.0 template /////////////////////////////////////////////////////////////////////////////////
	//								 ROLE				START						END
	this->naverRSS2_0.SetTemplate  ( "xml_version",     "<?xml version=\"",         "\""                     );
	this->naverRSS2_0.SetTemplate  ( "encoding",        "encoding=\"",              "\"?>"                   );
	this->naverRSS2_0.SetTemplate  ( "rss_version",     "<rss version=\"",          "\""                     );
	this->naverRSS2_0.SetTemplate  ( "channel",         "<channel>",                "</channel>"             );
	this->naverRSS2_0.SetTemplate  ( "chTitle",         "<title><![CDATA[",         "]]></title>"            );
	this->naverRSS2_0.SetTemplate  ( "chLink",          "<link>",                   "</link>"                );
	this->naverRSS2_0.SetTemplate  ( "chDesc",          "<description><![CDATA[",   "]]></description>"      );
	this->naverRSS2_0.SetTemplate  ( "language",        "<language>",               "</language>"            );
	this->naverRSS2_0.SetTemplate  ( "chPubDate",       "<pubDate>",                "</pubDate>"             );
	this->naverRSS2_0.SetTemplate  ( "generator",       "<generator>",              "</generator>"           );
	this->naverRSS2_0.SetTemplate  ( "chAuthor",        "<copyright>",		        "</copyright>"		     );
	this->naverRSS2_0.SetTemplate  ( "image",           "<image>",                  "</image>"               );
	this->naverRSS2_0.SetTemplate  ( "imgTitle",        "<title>",                  "</title>"               );
	this->naverRSS2_0.SetTemplate  ( "imgUrl",          "<url><![CDATA[",           "]]></url>"              );
	this->naverRSS2_0.SetTemplate  ( "imgWidth",        "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->naverRSS2_0.SetTemplate  ( "imgHeight",       "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->naverRSS2_0.SetTemplate  ( "imgDesc",         "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->naverRSS2_0.SetTemplate  ( "item",            "<item>",                   "</item>"                );
	this->naverRSS2_0.SetTemplate  ( "itemTitle",       "<title><![CDATA[",         "]]></title>"            );
	this->naverRSS2_0.SetTemplate  ( "itemLink",        "<link>",                   "</link>"                );
	this->naverRSS2_0.SetTemplate  ( "itemDesc",        "<description>",            "</description>"         );
	this->naverRSS2_0.SetTemplate  ( "itemAuthor",      "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->naverRSS2_0.SetTemplate  ( "tag",             "<category><![CDATA[",      "]]></category>"         );
	this->naverRSS2_0.SetTemplate  ( "itemPubDate",     "<pubDate>",                "</pubDate>"             );
	this->naverRSS2_0.SetTemplate  ( "comments",        "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );

	// Naver RSS 1.0 template /////////////////////////////////////////////////////////////////////////////////
	// 								 ROLE				START						END
	this->naverRSS1_0.SetTemplate  ( "xml_version",     "<?xml version=\"",         "\""                     );
	this->naverRSS1_0.SetTemplate  ( "encoding",        "encoding=\"",              "\"?>"                   );
	this->naverRSS1_0.SetTemplate  ( "rss_version",     "<rss version=\"",          "\""                     );
	this->naverRSS1_0.SetTemplate  ( "channel",         "<channel rdf:about=\"",    "</channel>"             );
	this->naverRSS1_0.SetTemplate  ( "chTitle",         "<title><![CDATA[",         "]]></title>"            );
	this->naverRSS1_0.SetTemplate  ( "chLink",          "<link>",                   "</link>"                );
	this->naverRSS1_0.SetTemplate  ( "chDesc",          "<description><![CDATA[",   "]]></description>"      );
	this->naverRSS1_0.SetTemplate  ( "language",        "<dc:language>",            "</dc:language>"         );
	this->naverRSS1_0.SetTemplate  ( "chPubDate",       "<dc:date>",                "</dc:date>"             );
	this->naverRSS1_0.SetTemplate  ( "generator",       "<dc:rights>",              "</dc:rights>"           );
	this->naverRSS1_0.SetTemplate  ( "chAuthor",        "<copyright>",              "</copyright>"           );
	this->naverRSS1_0.SetTemplate  ( "image",           "<image rdf:abount=\">",    "</image>"               );
	this->naverRSS1_0.SetTemplate  ( "imgTitle",        "<title><![CDATA[",         "]]></title>"            );
	this->naverRSS1_0.SetTemplate  ( "imgUrl",          "<url>",                    "</url>"                 );
	this->naverRSS1_0.SetTemplate  ( "imgWidth",        "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->naverRSS1_0.SetTemplate  ( "imgHeight",       "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->naverRSS1_0.SetTemplate  ( "imgDesc",         "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->naverRSS1_0.SetTemplate  ( "item",            "<item rdf:about=\">",      "</item>"                );
	this->naverRSS1_0.SetTemplate  ( "itemTitle",       "<title><![CDATA[",         "]]></title>"            );
	this->naverRSS1_0.SetTemplate  ( "itemLink",        "<link>",                   "</link>"                );
	this->naverRSS1_0.SetTemplate  ( "itemDesc",        "<description><![CDATA[",   "]]></description>"      );
	this->naverRSS1_0.SetTemplate  ( "itemAuthor",      "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->naverRSS1_0.SetTemplate  ( "tag",             "<category><![CDATA[",      "]]></category>"         );
	this->naverRSS1_0.SetTemplate  ( "itemPubDate",     "<dc:date>",                "</dc:date>"             );
	this->naverRSS1_0.SetTemplate  ( "comments",        "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );

	// Naver ATOM 0.3 template /////////////////////////////////////////////////////////////////////////////////
	this->naverATOM0_3.SetTemplate  ( "xml_version",     "<?xml version=\"",         "\""                     );
	this->naverATOM0_3.SetTemplate  ( "encoding",        "encoding=\"",              "\"?>"                   );
	this->naverATOM0_3.SetTemplate  ( "rss_version",     "<rss version=\"",          "\""                     );
	this->naverATOM0_3.SetTemplate  ( "channel",         "<channel rdf:about=\"",    "</channel>"             );
	this->naverATOM0_3.SetTemplate  ( "chTitle",         "<title><![CDATA[",         "]]></title>"            );
	this->naverATOM0_3.SetTemplate  ( "chLink",          "<link>",                   "</link>"                );
	this->naverATOM0_3.SetTemplate  ( "chDesc",          "<description><![CDATA[",   "]]></description>"      );
	this->naverATOM0_3.SetTemplate  ( "language",        "<dc:language>",            "</dc:language>"         );
	this->naverATOM0_3.SetTemplate  ( "chPubDate",       "<dc:date>",                "</dc:date>"             );
	this->naverATOM0_3.SetTemplate  ( "generator",       "<dc:rights>",              "</dc:rights>"           );
	this->naverATOM0_3.SetTemplate  ( "chAuthor",        "<copyright>",              "</copyright>"           );
	this->naverATOM0_3.SetTemplate  ( "image",           "<image rdf:abount=\">",    "</image>"               );
	this->naverATOM0_3.SetTemplate  ( "imgTitle",        "<title><![CDATA[",         "]]></title>"            );
	this->naverATOM0_3.SetTemplate  ( "imgUrl",          "<url>",                    "</url>"                 );
	this->naverATOM0_3.SetTemplate  ( "imgWidth",        "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->naverATOM0_3.SetTemplate  ( "imgHeight",       "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->naverATOM0_3.SetTemplate  ( "imgDesc",         "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->naverATOM0_3.SetTemplate  ( "item",            "<item rdf:about=\">",      "</item>"                );
	this->naverATOM0_3.SetTemplate  ( "itemTitle",       "<title><![CDATA[",         "]]></title>"            );
	this->naverATOM0_3.SetTemplate  ( "itemLink",        "<link>",                   "</link>"                );
	this->naverATOM0_3.SetTemplate  ( "itemDesc",        "<description><![CDATA[",   "]]></description>"      );
	this->naverATOM0_3.SetTemplate  ( "itemAuthor",      "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->naverATOM0_3.SetTemplate  ( "tag",             "<category><![CDATA[",      "]]></category>"         );
	this->naverATOM0_3.SetTemplate  ( "itemPubDate",     "<dc:date>",                "</dc:date>"             );
	this->naverATOM0_3.SetTemplate  ( "comments",        "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );


	// Egloos RSS 2.0 template ////////////////////////////////////////////////////////////////////////////////
	// 								 ROLE				START						END
	this->egloosRSS2_0.SetTemplate ( "xml_version",     "<?xml version=\"",         "\""                     );
	this->egloosRSS2_0.SetTemplate ( "encoding",        "encoding=\"",              "\"?>"                   );
	this->egloosRSS2_0.SetTemplate ( "rss_version",     "<rss version=\"",          "\">"                    );
	this->egloosRSS2_0.SetTemplate ( "channel",         "<channel>",                "\">"                    );
	this->egloosRSS2_0.SetTemplate ( "chTitle",         "<title>",                  "</title>"               );
	this->egloosRSS2_0.SetTemplate ( "chLink",          "<link>",                   "</link>"                );
	this->egloosRSS2_0.SetTemplate ( "chDesc",          "<description>",            "</description>"         );
	this->egloosRSS2_0.SetTemplate ( "language",        "<language>",               "</language>"            );
	this->egloosRSS2_0.SetTemplate ( "chPubDate",       "<pubDate>",                "</pubDate>"             );
	this->egloosRSS2_0.SetTemplate ( "generator",       "<generator>",              "</generator>"           );
	this->egloosRSS2_0.SetTemplate ( "chAuthor",        "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->egloosRSS2_0.SetTemplate ( "image",           "<image>",                  "</image>"               );
	this->egloosRSS2_0.SetTemplate ( "imgTitle",        "<title>",                  "</title>"               );
	this->egloosRSS2_0.SetTemplate ( "imgUrl",          "<url>",                    "</url>"                 );
	this->egloosRSS2_0.SetTemplate ( "imgLink",         "<link>",       		    "</link>" 	             );
	this->egloosRSS2_0.SetTemplate ( "imgWidth",        "<width>",                  "</width>"               );
	this->egloosRSS2_0.SetTemplate ( "imgHeight",       "<height>",                 "</height>"              );
	this->egloosRSS2_0.SetTemplate ( "imgDesc",         "<description>",            "</description>"         );
	this->egloosRSS2_0.SetTemplate ( "item",            "<item>",                   "</item>"                );
	this->egloosRSS2_0.SetTemplate ( "itemTitle",       "<title><![CDATA[",         "]]> </title>"           );
	this->egloosRSS2_0.SetTemplate ( "itemLink",        "<link>",                   "</link>"                );
	this->egloosRSS2_0.SetTemplate ( "itemDesc",        "<description>\r\n\t\t\t<![CDATA[", "</description>"		 );
	this->egloosRSS2_0.SetTemplate ( "itemAuthor",      "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->egloosRSS2_0.SetTemplate ( "tag",             "<category>",               "</category>"            );
	this->egloosRSS2_0.SetTemplate ( "itemPubDate",     "<pubDate>",                "</pubDate>"             );
	this->egloosRSS2_0.SetTemplate ( "comments",        "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );


	// Youtube ATOM 0.3 template ///////////////////////////////////////////////////////////////////////////////
	// 								 ROLE				START						END
	this->youtubeATOM0_3.SetTemplate( "xml_version",     "<?xml version=\"",         "\""                     );
	this->youtubeATOM0_3.SetTemplate( "encoding",        "encoding=\"",              "\"?>"                   );
	this->youtubeATOM0_3.SetTemplate( "rss_version",     "<rss version=\"",          "\">"                    );
	this->youtubeATOM0_3.SetTemplate( "channel",         "<channel>",                "\">"                    );
	this->youtubeATOM0_3.SetTemplate( "chTitle",         "<title>",                  "</title>"               );
	this->youtubeATOM0_3.SetTemplate( "chLink",          "<link>",                   "</link>"                );
	this->youtubeATOM0_3.SetTemplate( "chDesc",          "<description>",            "</description>"         );
	this->youtubeATOM0_3.SetTemplate( "language",        "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->youtubeATOM0_3.SetTemplate( "pubDate",         "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->youtubeATOM0_3.SetTemplate( "generator",       "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->youtubeATOM0_3.SetTemplate( "chAuthor",        "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->youtubeATOM0_3.SetTemplate( "image",           "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->youtubeATOM0_3.SetTemplate( "imgTitle",        "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->youtubeATOM0_3.SetTemplate( "imgUrl",          "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->youtubeATOM0_3.SetTemplate( "imgWidth",        "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->youtubeATOM0_3.SetTemplate( "imgHeight",       "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->youtubeATOM0_3.SetTemplate( "imgDesc",         "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->youtubeATOM0_3.SetTemplate( "item",            "<item>",                   "</item>"                );
	this->youtubeATOM0_3.SetTemplate( "itemTitle",       "<title>",                  "</title>"               );
	this->youtubeATOM0_3.SetTemplate( "itemLink",        "<link>",                   "</link>"                );
	this->youtubeATOM0_3.SetTemplate( "itemDesc",        "<description>",            "</description>"         );
	this->youtubeATOM0_3.SetTemplate( "itemAuthor",      "<author>",                 "</author>"              );
	this->youtubeATOM0_3.SetTemplate( "tag",             "<media:category label=\"Tags\">","</media:category>");
	this->youtubeATOM0_3.SetTemplate( "itemPubDate",     "<pubDate>",                "</pubDate>"             );
	this->youtubeATOM0_3.SetTemplate( "comments",        "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );


	// Allblog RSS 2.0 template ////////////////////////////////////////////////////////////////////////////////
	// 								 ROLE				START						END
	this->allblogRSS2_0.SetTemplate ( "xml_version",     "<?xml version=\"",         "\""                     );
	this->allblogRSS2_0.SetTemplate ( "encoding",        "encoding=\"",              "\"?>"                   );
	this->allblogRSS2_0.SetTemplate ( "rss_version",     "<rss version=\"",          "\">"                    );
	this->allblogRSS2_0.SetTemplate ( "channel",         "<channel>",                "</channel>"             );
	this->allblogRSS2_0.SetTemplate ( "chTitle",         "<title>",                  "</title>"               );
	this->allblogRSS2_0.SetTemplate ( "chLink",          "<link>",                   "</link>"                );
	this->allblogRSS2_0.SetTemplate ( "chDesc",          "<description><![CDATA[",   "]]></description>"      );
	this->allblogRSS2_0.SetTemplate ( "language",        "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->allblogRSS2_0.SetTemplate ( "chPubDate",       "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->allblogRSS2_0.SetTemplate ( "generator",       "<generator>",              "</generator>"           );
	this->allblogRSS2_0.SetTemplate ( "chAuthor",        "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->allblogRSS2_0.SetTemplate ( "image",           "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->allblogRSS2_0.SetTemplate ( "imgTitle",        "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->allblogRSS2_0.SetTemplate ( "imgUrl",          "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->allblogRSS2_0.SetTemplate ( "imgLink",         "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->allblogRSS2_0.SetTemplate ( "imgWidth",        "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->allblogRSS2_0.SetTemplate ( "imgHeight",       "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->allblogRSS2_0.SetTemplate ( "imgDesc",         "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );
	this->allblogRSS2_0.SetTemplate ( "item",            "<item>",                   "</item>"                );
	this->allblogRSS2_0.SetTemplate ( "itemTitle",       "<title>",    			     "</title>"       	      );
	this->allblogRSS2_0.SetTemplate ( "itemLink",        "<source url=\"",           "\">"                	  );
	this->allblogRSS2_0.SetTemplate ( "itemDesc",        "<description><![CDATA[",   "]]></description>"      );
	this->allblogRSS2_0.SetTemplate ( "itemAuthor",      "<author>",        		 "</author>"   			  );
	this->allblogRSS2_0.SetTemplate ( "tag",             "<category>",               "</category>"            );
	this->allblogRSS2_0.SetTemplate ( "itemPubDate",     "<pubDate>",                "</pubDate>"             );
	this->allblogRSS2_0.SetTemplate ( "comments",        "NOT SUPPORTED TAG",        "NOT SUPPORTED TAG"      );

	

}

DocTemplate::DocTemplate( const DocTemplate& source )
{
	this->tistoryRSS2_0 = source.tistoryRSS2_0;
	this->naverRSS2_0   = source.naverRSS2_0;
	this->egloosRSS2_0	= source.egloosRSS2_0;
	this->allblogRSS2_0 = source.allblogRSS2_0;
//	this->youtubeRSS2_0 = source.youtubeRSS2_0;
	//..other Template Space
}

DocTemplate::~DocTemplate()
{
}

DocTemplate& DocTemplate::operator = ( const DocTemplate& source )
{
	this->tistoryRSS2_0 = source.tistoryRSS2_0;
	this->naverRSS2_0   = source.naverRSS2_0;
	this->egloosRSS2_0  = source.egloosRSS2_0;
	this->allblogRSS2_0 = source.allblogRSS2_0;
//	this->youtubeRSS2_0 = source.youtubeRSS2_0;

	return (*this);
}


//General Function //

void DocTemplate::LoadTemplate()
{
	//Loading from DB or File 
}


DocStructure DocTemplate::GetTemplate( string service )
{
	DocStructure ret;

	if ( strcmp ( service.c_str(), "tistoryRSS2_0" ) == 0 )
	{
		ret = this->tistoryRSS2_0;
	}
	else if ( strcmp ( service.c_str(), "naverRSS2_0" ) == 0 )
	{
		ret = this->naverRSS2_0;
	}
	else if ( strcmp ( service.c_str(), "egloosRSS2_0" ) == 0 )
	{
		ret = this->egloosRSS2_0;
	}
	else if ( strcmp ( service.c_str(), "allblogRSS2_0" ) == 0 )
	{
		ret = this->allblogRSS2_0;
	}
//	else if ( strcmp ( service.c_str(), "youtubeRSS2_0" ) == 0 )
//	{
//		ret = this->youtubeRSS2_0;
//	}
	else
	{
	
	}


	return ret;
}


#if 0
int main()
{
	DocTemplate docTemplate;

	return 0;
}
#endif



